package com.g2.admin.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.g2.admin.model.po.AuthPermitRolePo;
import com.g2.admin.model.po.AuthRoleUserPo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface IAuthRoleUserMapper extends BaseMapper<AuthRoleUserPo>{

    /**
     * 获取用户角色的所有权限
     *
     * @param userId
     * @return
     */
    @Select("SELECT a.auth_code FROM auth_permit_role a, auth_role_user b WHERE a.role_code=b.role_code AND b.user_id=#{idNo}")
    List<String> selectUserRoleAuths(@Param("userId") long userId);
}